<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
  <title>Busca de Mercadorias</title>
</head>
<body>
  <div class="nav">
    <!--<span class="menuButton"><g:link class="create" action="create">New ${entityName}</g:link></span>-->
  </div>
  <div class="body">
    <h1>Busca de Mercadorias</h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:form name="searchFormMercadoriaPorId" action="buscarMercadoriaPorId">
      <input type="text" id="codigoMercadoria" name="codigoMercadoria" value=""/>
      <g:actionSubmit action="buscarMercadoriaPorId" value="Buscar Por Código" />
    </g:form>

    <g:form name="searchFormMercadoriaPorNome" action="buscarMercadoriaPorNome">
      <input type="text" id="nomeMercadoria" name="nomeMercadoria" value=""/>
      <g:actionSubmit action="buscarMercadoriaPorNome" value="Buscar Por Nome" />
    </g:form>    
    <div class="list">
      <table>
        <thead>
          <tr>

        <g:sortableColumn property="id" title="Código" />

        <g:sortableColumn property="nome" title="Nome" />

        </tr>
        </thead>
        <tbody>
        <g:each in="${mercadoriaList}" status="i" var="mercadoriaInstance">
          <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
            <td><g:link action="selecionarMercadoria" id="${mercadoriaInstance.id}" params='[nome:"${mercadoriaInstance.nome.encodeAsHTML()}"]'>${fieldValue(bean:mercadoriaInstance, field:'id')}</g:link></td>

          <td>${fieldValue(bean:mercadoriaInstance, field:'nome')}</td>

          </tr>
        </g:each>
        </tbody>
      </table>
      <div class="paginateButtons">
        <g:if test="${mercadoriaList == null}">
          <g:paginate total="0" />
        </g:if>
        <g:else>
          <g:paginate total="${mercadoriaList.size()}" />
        </g:else>
      </div>
    </div>
  </div>
</body>
</html>